<?php
include_once "xAP-functions/webincludes.php";



$now=date("Y-m-d H:i:s");


$sql="select xAP_TV_Prog.ChannelName,xAP_TV_Prog.ProgName,xAP_TV_Prog.ProgStart,xAP_TV_Prog.ProgEnd,
xAP_TV_Channel.ChannelAlias ,xAP_TV_Prog.ProgDesc,xAP_TV_Channel.ChannelID,xAP_TV_Prog.TriggerEvent,
xAP_TV_Prog.TriggerTime
from xAP_TV_Prog 
INNER JOIN xAP_TV_Channel on xAP_TV_Channel.ChannelName=xAP_TV_Prog.ChannelName

where  TriggerTime>='".$now."' and xAP_TV_Prog.TriggerEvent<>''
order by xAP_TV_Prog.ProgStart,xAP_TV_Channel.ChannelOrder
limit 6
";
$results=dbquery($sql);

//display
$body="<table class='widget' cellpadding=0 cellspacing=0>";
foreach($results as $row){
	$body.="
	<tr>
<TD width=33>
<a href='/".$config["modulefolder"]."/channel.php?id=".$row["ChannelID"]."'>
<img src='/".$config["modulefolder"]."/images/channels/".$row["ChannelName"].".jpg' height=25 width=33>
</a>
</td>
<TD class='normalsmalltext'>
<B>".$row["ProgName"]."</B><BR>
".date("j F, Y, g:i a",strtotime($row["ProgStart"]))."
</td>
</tr>";
}

$body.="</table>".$extradata;



echo $body;
?>



